class BrowseHistory {
  int? id;
  String noteId;
  String? title;
  String? coverPicture;
  int type; // 0: 图片故事, 1: 视频故事
  int browseTime;
  String? authorId;
  String? authorName;

  BrowseHistory({
    this.id,
    required this.noteId,
    this.title,
    this.coverPicture,
    required this.type,
    required this.browseTime,
    this.authorId,
    this.authorName,
  });

  Map<String, dynamic> toMap() {
    return {
      'id': id,
      'noteId': noteId,
      'title': title,
      'coverPicture': coverPicture,
      'type': type,
      'browseTime': browseTime,
      'authorId': authorId,
      'authorName': authorName,
    };
  }

  factory BrowseHistory.fromMap(Map<String, dynamic> map) {
    return BrowseHistory(
      id: map['id'],
      noteId: map['noteId'],
      title: map['title'],
      coverPicture: map['coverPicture'],
      type: map['type'],
      browseTime: map['browseTime'],
      authorId: map['authorId'],
      authorName: map['authorName'],
    );
  }
}